\hypertarget{group__internal__comm__group}{
\section{Internal communication routines}
\label{group__internal__comm__group}\index{Internal communication routines@{Internal communication routines}}
}
\subsection*{Files}
\begin{CompactItemize}
\item 
file \hyperlink{internal__comm_8c}{internal\_\-comm.c}
\begin{CompactList}\small\item\em The internal communication routines. \item\end{CompactList}

\item 
file \hyperlink{internal__comm__commands_8h}{internal\_\-comm\_\-commands.h}
\begin{CompactList}\small\item\em The internal communication commands. \item\end{CompactList}

\item 
file \hyperlink{internal__comm__rx__queue_8c}{internal\_\-comm\_\-rx\_\-queue.c}
\begin{CompactList}\small\item\em The internal communication RX QUEUE. \item\end{CompactList}

\item 
file \hyperlink{internal__comm__rx__queue_8h}{internal\_\-comm\_\-rx\_\-queue.h}
\begin{CompactList}\small\item\em The internal communication RX QUEUE. \item\end{CompactList}

\item 
file \hyperlink{internal__comm__tx__queue_8c}{internal\_\-comm\_\-tx\_\-queue.c}
\begin{CompactList}\small\item\em The internal communication TX QUEUE. \item\end{CompactList}

\end{CompactItemize}


\subsection{Detailed Description}
When using these routines for the internal communication it's important to initialize the pointers for the transmit and recieve data before any of the other functions are used. This is done by using the void internal\_\-comm\_\-init(void ($\ast$func\_\-ptr\_\-rx)(\hyperlink{structUC__MESSAGE}{UC\_\-MESSAGE}), void ($\ast$func\_\-ptr\_\-tx)(char)); where func\_\-ptr\_\-rx and func\_\-ptr\_\-rx should point the functions which take the argument of \hyperlink{structUC__MESSAGE}{UC\_\-MESSAGE}.

Doing it this way makes the routines adaptable do different hardware, you just change the routine for TX and RX of data.

When a message has been recieved it will be added to the RX queue and by polling communication by using \hyperlink{internal__comm_8h_64c4f318386e5cad700f6c5e08677c6f}{internal\_\-comm\_\-poll\_\-rx\_\-queue(void)} if there is a message in the queue it will get sent to the routine which was specified in the initialization routine.

You will also need to poll the \hyperlink{internal__comm_8c_35f8e503f80c8e1188ad09c1c0dde6ec}{internal\_\-comm\_\-poll\_\-tx\_\-queue()} at x intervals so that messages are sent when the tx queue isn't empty. 